<template>
  <div class="tactInfo-initDeployRelateDescriptForm">
    <el-form :model="ruleForm" :inline="true" ref="formRef">
      <el-row :gutter="24">
        <el-col :span="8">
          <el-form-item
            label="弹目距离"
            prop="bulletTargetDistance"
            label-width="90px"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'blur',
            }"
          >
            <el-input
              v-model="ruleForm.bulletTargetDistance"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
      </el-row>

      <TagIcon title="导引头战技使用描述项" />
      <el-row :gutter="24">
        <el-col :span="8">
          <el-form-item
            label="工作状态"
            prop="dytTacticInfoVO.workStatus"
            label-width="90px"
            :rules="{
              required: true,
              message: '请选择',
              trigger: 'change',
            }"
          >
            <el-select
              v-model="ruleForm.dytTacticInfoVO.workStatus"
              clearable
              placeholder="请选择"
              :disabled="disabled"
            >
              <el-option label="未开机" value="未开机" />
              <el-option
                label="开机(搜索、截获、跟踪)"
                value="开机(搜索、截获、跟踪)"
              />
            </el-select>
          </el-form-item>
          <el-form-item
            label="工作策略"
            prop="dytTacticInfoVO.workStrategy"
            label-width="90px"
          >
            <el-input
              v-model="ruleForm.dytTacticInfoVO.workStrategy"
              type="textarea"
              :rows="3"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="姿态信息"
            prop="dytTacticInfoVO.attitudeInfo"
            label-width="90px"
          >
            <el-select
              v-model="ruleForm.dytTacticInfoVO.attitudeInfo"
              clearable
              placeholder="请选择"
              :disabled="disabled"
            >
              <el-option label="俯仰角" value="俯仰角" />
              <el-option label="方位角" value="方位角" />
              <el-option label="滚转角" value="滚转角" />
            </el-select>
          </el-form-item>
          <el-form-item
            label="其他"
            prop="dytTacticInfoVO.elseInfo"
            label-width="90px"
          >
            <el-input
              v-model="ruleForm.dytTacticInfoVO.elseInfo"
              type="textarea"
              :rows="3"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8"> </el-col>
      </el-row>

      <TagIcon title="目标战技使用描述项" />
      <el-row :gutter="24">
        <el-col :span="8">
          <el-form-item
            label="运动状态"
            prop="targetTacticInfoVO.moveStatus"
            :rules="{
              required: true,
              message: '请输入',
              trigger: 'blur',
            }"
          >
            <el-input
              v-model="ruleForm.targetTacticInfoVO.moveStatus"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
          <el-form-item label="船体RCS" prop="targetTacticInfoVO.hullRcs">
            <el-input
              v-model="ruleForm.targetTacticInfoVO.hullRcs"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item
            label="运动方向"
            prop="targetTacticInfoVO.moveDirection"
          >
            <el-input
              v-model="ruleForm.targetTacticInfoVO.moveDirection"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
          <el-form-item label="船体姿态" prop="targetTacticInfoVO.hullAttitude">
            <el-input
              v-model="ruleForm.targetTacticInfoVO.hullAttitude"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
        <el-col :span="8">
          <el-form-item label="运动速度" prop="targetTacticInfoVO.moveSpeed">
            <el-input
              v-model="ruleForm.targetTacticInfoVO.moveSpeed"
              placeholder="请输入"
              :disabled="disabled"
            />
          </el-form-item>
        </el-col>
      </el-row>

      <div v-if="props.interferType === '舰载有源干扰-雷达'">
        <TagIcon title="干扰装备战技使用描述项(舰载有源干扰装备)" />
        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item
              label="开关状态"
              prop="shipborneUseVO.switchStatus"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.shipborneUseVO.switchStatus"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="开机" value="开机" />
                <el-option label="关机" value="关机" />
                <el-option label="静默" value="静默" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="辐射功率"
              prop="shipborneUseVO.equivalentRadiatedPower"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.equivalentRadiatedPower"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="侦收时间窗"
              prop="shipborneUseVO.sweepingPeriod"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.sweepingPeriod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="干扰样式参数设置描述项"
              prop="shipborneUseVO.jammingStyle"
              label-width="100px"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.jammingStyle"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="工作模式"
              prop="shipborneUseVO.workingMode"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.shipborneUseVO.workingMode"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="侦收" value="侦收" />
                <el-option label="干扰" value="干扰" />
                <el-option label="协同" value="协同" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="中心频率"
              prop="shipborneUseVO.centerFrequency"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.centerFrequency"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="干扰时间窗"
              prop="shipborneUseVO.jammingPeriod"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.jammingPeriod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="其他"
              prop="shipborneUseVO.elseInfo"
              label-width="70px"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.elseInfo"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="干扰方向"
              prop="shipborneUseVO.interDirection"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.shipborneUseVO.interDirection"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="方位角" value="方位角" />
                <el-option label="俯仰角" value="俯仰角" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="收发方式"
              prop="shipborneUseVO.transmitReceiveMethod"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.shipborneUseVO.transmitReceiveMethod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="干扰样式"
              prop="shipborneUseVO.jammingMode"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.shipborneUseVO.jammingMode"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="俯仰角" value="俯仰角" />
                <el-option label="方位角" value="方位角" />
                <el-option label="滚转角" value="滚转角" />
              </el-select>
            </el-form-item>
          </el-col>
        </el-row>
      </div>

      <div v-if="props.interferType === '舷外有源干扰-雷达'">
        <TagIcon title="干扰装备战技使用描述项(舷外有源干扰装备)" />
        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item
              label="发射器位置"
              prop="outboardUseVO.launcherLocation"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.launcherLocation"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="干扰方向"
              prop="outboardUseVO.interDirection"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.outboardUseVO.interDirection"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="方位角" value="方位角" />
                <el-option label="俯仰角" value="俯仰角" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="收发方式"
              prop="outboardUseVO.transmitReceiveMethod"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.transmitReceiveMethod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="干扰样式参数设置描述项"
              prop="outboardUseVO.jammingStyle"
              label-width="100px"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.jammingStyle"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="开关状态"
              prop="outboardUseVO.switchStatus"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.outboardUseVO.switchStatus"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="开机" value="开机" />
                <el-option label="关机" value="关机" />
                <el-option label="静默" value="静默" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="辐射功率"
              prop="outboardUseVO.equivalentRadiatedPower"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.equivalentRadiatedPower"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="侦收时间窗"
              prop="outboardUseVO.sweepingPeriod"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.sweepingPeriod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="其他"
              prop="outboardUseVO.elseInfo"
              label-width="70px"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.elseInfo"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="工作模式"
              prop="outboardUseVO.workingMode"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.outboardUseVO.workingMode"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="侦收" value="侦收" />
                <el-option label="干扰" value="干扰" />
                <el-option label="协同" value="协同" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="中心频率"
              prop="outboardUseVO.centerFrequency"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.outboardUseVO.centerFrequency"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item label="干扰时间窗" prop="outboardUseVO.jammingPeriod">
              <el-input
                v-model="ruleForm.outboardUseVO.jammingPeriod"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>

      <div v-if="props.interferType === '箔条干扰-雷达'">
        <TagIcon title="干扰装备战技使用描述项(箔条干扰装备)" />
        <el-row :gutter="24">
          <el-col :span="14">
            <el-form-item
              label="战术使用方式简述"
              prop="chaffJammingUseVO.tacticUseDes"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.tacticUseDes"
                input-style="width: 600px;"
                type="textarea"
                :rows="4"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
        </el-row>

        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item label="发射数量" prop="chaffJammingUseVO.launchCount">
              <el-input
                v-model="ruleForm.chaffJammingUseVO.launchCount"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="箔条弹型号"
              prop="chaffJammingUseVO.chaffModel"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.chaffModel"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="其他"
              prop="chaffJammingUseVO.elseInfo"
              label-width="70px"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.elseInfo"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="发射器位置"
              prop="chaffJammingUseVO.launcherLocation"
              :rules="{
                required: true,
                message: '请输入',
                trigger: 'blur',
              }"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.launcherLocation"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="每枚弹的发射距离"
              prop="chaffJammingUseVO.launchDistance"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.launchDistance"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="发射状态"
              prop="chaffJammingUseVO.launchStatus"
            >
              <el-select
                v-model="ruleForm.chaffJammingUseVO.launchStatus"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="俯仰角" value="俯仰角" />
                <el-option label="方位角" value="方位角" />
                <el-option label="滚转角" value="滚转角" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="每枚弹的发射方向与角度"
              prop="chaffJammingUseVO.launchDirectionAngle"
            >
              <el-input
                v-model="ruleForm.chaffJammingUseVO.launchDirectionAngle"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>

      <div v-if="props.interferType === '角反干扰-雷达'">
        <TagIcon title="干扰装备战技使用描述项(角反射器干扰装备)" />
        <el-row :gutter="24">
          <el-col :span="14">
            <el-form-item
              label="战术使用方式简述"
              prop="cornerReflectorUseVO.tacticUseDes"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.tacticUseDes"
                input-style="width: 600px;"
                type="textarea"
                :rows="4"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="24">
          <el-col :span="8">
            <el-form-item
              label="布设状态"
              prop="cornerReflectorUseVO.deployStatus"
              :rules="{
                required: true,
                message: '请选择',
                trigger: 'change',
              }"
            >
              <el-select
                v-model="ruleForm.cornerReflectorUseVO.deployStatus"
                clearable
                placeholder="请选择"
                :disabled="disabled"
              >
                <el-option label="未布设" value="未布设" />
                <el-option label="布设中" value="布设中" />
                <el-option label="完成布设" value="完成布设" />
              </el-select>
            </el-form-item>
            <el-form-item
              label="布设器位置"
              prop="cornerReflectorUseVO.deployerLocation"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.deployerLocation"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="其他"
              prop="cornerReflectorUseVO.elseInfo"
              label-width="70px"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.elseInfo"
                type="textarea"
                :rows="3"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="布设数量"
              prop="cornerReflectorUseVO.deployCount"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.deployCount"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="布设距离"
              prop="cornerReflectorUseVO.deployDistance"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.deployDistance"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item
              label="布设形式"
              prop="cornerReflectorUseVO.deployStyle"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.deployStyle"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
            <el-form-item
              label="布设角度"
              prop="cornerReflectorUseVO.deployAngle"
            >
              <el-input
                v-model="ruleForm.cornerReflectorUseVO.deployAngle"
                placeholder="请输入"
                :disabled="disabled"
              />
            </el-form-item>
          </el-col>
        </el-row>
      </div>

      <div class="form-footer common-buttons" v-if="!disabled">
        <el-button type="primary" @click="onSubmit(formRef, 'form')"
          >保存</el-button
        >
        <el-button type="primary" @click="onReset(formRef)">取消</el-button>
      </div>
    </el-form>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, reactive, ref, watch } from 'vue';
import TagIcon from '@/components/tag-icon/index.vue';
import { FormInstance, ElMessage } from 'element-plus';
import { httpSaveTactInfoInitDeployDescriptItem } from '@/api/testSampleData';
import { useRoute, useRouter } from 'vue-router';
const route = useRoute();

const isLook = route.query.layerType === 'look' ? true : false;
const disabled = ref<boolean>(isLook);

// 接收父组件传递过来的props
const props = defineProps({
  interferType: { type: String, default: '舰载有源干扰-雷达' },
  dataSourceObject: {
    type: Object,
    default: () => {
      return {};
    },
  },
});

const formRef = ref<FormInstance>();
const validateState3 = ref(false);
const ruleForm = ref<any>({
  bulletTargetDistance: '', //弹目距离
  // 导引头战技使用描述项
  dytTacticInfoVO: {
    workStatus: '',
    attitudeInfo: '',
    workStrategy: '',
    elseInfo: '',
  },

  // 目标战技使用描述项
  targetTacticInfoVO: {
    moveStatus: '',
    moveDirection: '',
    moveSpeed: '',
    hullRcs: '',
    hullAttitude: '',
  },

  // 背景环境过程描述项
  // bgEnviProcessInfoVO: {
  //   waveLevel: '',
  //   windSpeed: '',
  //   windDirection: '',
  //   elseInfo: '',
  // },

  // 干扰装备初始部署信息项(舰载有源干扰装备-雷达)
  shipborneUseVO: {
    switchStatus: '',
    workingMode: '',
    interDirection: '',
    equivalentRadiatedPower: '',
    centerFrequency: '',
    transmitReceiveMethod: '',
    sweepingPeriod: '',
    jammingPeriod: '',
    jammingStyle: '',
    elseInfo: '',
    jammingMode: '',
  },

  // 干扰装备初始部署信息项(舷外有源干扰装备-雷达)
  outboardUseVO: {
    launcherLocation: '',
    interDirection: '',
    transmitReceiveMethod: '',
    jammingStyle: '',
    switchStatus: '',
    equivalentRadiatedPower: '',
    sweepingPeriod: '',
    elseInfo: '',
    workingMode: '',
    centerFrequency: '',
    jammingPeriod: '',
  },

  // 干扰装备初始部署信息项(箔条干扰装备-雷达)
  chaffJammingUseVO: {
    tacticUseDes: '',
    launchCount: '',
    launcherLocation: '',
    launchStatus: '',
    chaffModel: '',
    launchDistance: '',
    launchDirectionAngle: '',
    elseInfo: '',
  },

  // 干扰装备初始部署信息项(角反射器干扰装备-雷达)
  cornerReflectorUseVO: {
    tacticUseDes: '',
    deployStatus: '',
    deployCount: '',
    deployStyle: '',
    deployerLocation: '',
    deployDistance: '',
    deployAngle: '',
    elseInfo: '',
  },
});

watch(
  () => props.dataSourceObject,
  (newValue, oldValue) => {
    const { dynamicPara } = newValue;
    if (dynamicPara && dynamicPara.length) {
      const {
        dytTacticInfoVO,
        targetTacticInfoVO,
        // bgEnviProcessInfoVO,
        shipborneUseVO,
        outboardUseVO,
        chaffJammingUseVO,
        cornerReflectorUseVO,
        bulletTargetDistance, //弹目距离
      } = dynamicPara[0];
      ruleForm.value = {
        dytTacticInfoVO,
        targetTacticInfoVO,
        // bgEnviProcessInfoVO,
        shipborneUseVO,
        outboardUseVO,
        chaffJammingUseVO,
        cornerReflectorUseVO,
        bulletTargetDistance,
      };
    }
  }
);

// 保存
const onSubmit = async (
  formEl: FormInstance | undefined,
  submitType: string
) => {
  if (!formEl) return;
  await formEl.validate((valid, fields) => {
    if (valid) {
      validateState3.value = false;
      const { bulletTargetDistance } = ruleForm.value;
      const params = {
        dytTacticInfoList: [
          { bulletTargetDistance, ...ruleForm.value.dytTacticInfoVO },
        ],
        targetTacticInfoList: [
          { bulletTargetDistance, ...ruleForm.value.targetTacticInfoVO },
        ],
        shipborneUseList: [
          { bulletTargetDistance, ...ruleForm.value.shipborneUseVO },
        ],
        outboardUseList: [
          { bulletTargetDistance, ...ruleForm.value.outboardUseVO },
        ],
        chaffJammingUseList: [
          { bulletTargetDistance, ...ruleForm.value.chaffJammingUseVO },
        ],
        cornerReflectorUseList: [
          { bulletTargetDistance, ...ruleForm.value.cornerReflectorUseVO },
        ],
        sampleId: route.query.sampleId,
        interType: route.query.interType,
      };

      httpSaveTactInfoInitDeployDescriptItem(params).then((res: any) => {
        const { code, message } = res;
        if (code === 200) {
          // 当submitType为form，表单提交
          if (submitType === 'form') {
            ElMessage({
              message: message || '保存成功',
              type: 'success',
            });
          }
        }
      });
    } else {
      validateState3.value = true;
      console.log('error submit!', fields);
    }
  });
};

const onReset = (formEl: FormInstance | undefined) => {
  if (!formEl) return;
  formEl.resetFields();
};

defineExpose({ onSubmit, formRef, validateState3 });
</script>

<style lang="scss" scoped>
.tactInfo-initDeployRelateDescriptForm {
  height: calc(100vh - 290px);
  padding: 20px;
  // width: 100%;
  overflow-y: scroll;
  .el-form--inline .el-form-item {
    width: 100%;
  }
  .el-select--small {
    width: 100%;
  }
  .el-row {
    margin-right: 0 !important;
  }

  .form-footer {
    display: flex;
    justify-content: center;
    margin-top: 30px;
  }
}
</style>
